﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KFC.MonAnF
{
    public abstract class PhanAnBuilder
    {
        public abstract void BuildPartGaRanTruyenThong();
        public abstract void BuildPartThucAnNhe();
        public abstract void BuildPartThucAnPhu();
        public abstract void BuildPartMonTrangMiengGiaiKhat();
        public abstract PhanAn GetResult();

        public void Builder(string tenLoaiDoiTuong, string tenForm, PhanAn phanAn)
        {
            List<MonAn> listMonAn = new List<MonAn>();
            foreach (MonAn ma in QuanLyMonAn.dsMonAn)
            {
                if (ma.LayTenLoaiDoiTuong() == tenLoaiDoiTuong)
                    listMonAn.Add(ma);
            }
            ThemPhanAnForm tpaf = new ThemPhanAnForm(listMonAn, tenForm);
            tpaf.ShowDialog();
            if (tpaf.MaMonAn != null)
            {
                phanAn.DsMaMonAnDon.Add(tpaf.MaMonAn);
                phanAn.DsSoLuongMon.Add(tpaf.SoLuong);
            }
        }
    }
}
